package com.artPreter.service.impl;

import com.artPreter.pojo.*;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.artPreter.mapper.ContentPictureRelativeMapper;
import com.artPreter.pojo.Picture;
import com.artPreter.mapper.PictureMapper;
import com.artPreter.service.IPictureService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.UUID;

/**
 * <p>
 * 图片表 服务实现类
 * </p>
 *
 * @author jarvis
 * @since 2024-11-21
 */
@Service
public class PictureServiceImpl extends ServiceImpl<PictureMapper, Picture> implements IPictureService {


    @Override
    public List<Picture> getArtistRelatedPictureList(ArtistContentSection artistContentSection, int i) {
        String contentId = artistContentSection.getContentId();
        QueryWrapper<Picture> pictureQueryWrapper = new QueryWrapper<>();
        pictureQueryWrapper.eq("s.content_id", contentId);
        pictureQueryWrapper.isNotNull("b.url");
        if(i==-99){

        }else{
            pictureQueryWrapper.last("limit " + i);
        }
        List<Picture> result = this.baseMapper.getArtistRelatedPictureList(pictureQueryWrapper);
        return result;
    }

    @Override
    public List<Picture> getEventExhibitionRelatedPictureList(EventExhibitionContentSection eventExhibitionContentSection, int i) {
        String contentId = eventExhibitionContentSection.getContentId();
        QueryWrapper<Picture> pictureQueryWrapper = new QueryWrapper<>();
        pictureQueryWrapper.eq("s.content_id", contentId);
        pictureQueryWrapper.isNotNull("b.url");
        if(i==-99){

        }else{
            pictureQueryWrapper.last("limit " + i);
        }
        List<Picture> result = this.baseMapper.getArtistRelatedPictureList(pictureQueryWrapper);
        return result;
    }

}
